#include<stdio.h>
#include<stdlib.h>

typedef struct TreeNode {
    char data;
    struct TreeNode* lchild;
    struct TreeNode* rchild;
}TreeNode;


typedef struct QueueNode {
     TreeNode * T;
     struct QueueNode* pre;
     struct QueueNode* next;

}QueueNode;

 void createBtree(TreeNode * *T, char* data, int* index) {
     char ch;
     ch = data[*index];
 * index += 1;
     if (ch == '#') {
 (*T)->data = NULL;

	}
	else {
 * T = (TreeNode*)malloc(sizeof(TreeNode));
 (*T)->data = ch;
         createBtree(&((*T)->lchild), data, index);
        createBtree(&((*T)->rchild), data, index);

	}

}

 void preOder(TreeNode * T) {
     if (T == NULL) {
         return 0;

	}
else {
         printf("%c ", T->data);
         preOder(T->lchild);
         preOder(T->rchild);

	}

}
 int main(int argc, char* argv[])
 {
     TreeNode * T;
     int index = 0;
     createBtree(&T, argv[1], &index);
     preOder(T);
     printf("\n");

     return 0;
 }
